/**
 * @Author: Jackey 327156719@qq.com
 * @Date: 2024-12-03 13:34:25
 * @LastEditors: Jackey 327156719@qq.com
 * @LastEditTime: 2024-12-03 13:34:40
 * @FilePath: src/main/java/org/springblade/modules/admin/utils/AsyncTask.java
 * @Description: 这是默认设置,可以在设置》工具》File Description中进行配置
 */
package org.springblade.modules.admin.utils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.stereotype.Component;

// 工具类
@Component
public class AsyncTask {
    private static AsyncTaskExecutor asyncTaskExecutor;

    @Autowired
    public void setAsyncTaskExecutor(AsyncTaskExecutor asyncTaskExecutor) {
        AsyncTask.asyncTaskExecutor = asyncTaskExecutor;
    }

    public static void execute(Runnable runnable) {
        asyncTaskExecutor.execute(runnable);
    }
}
